from Crypto.Cipher import AES
from dataclasses import dataclass

@dataclass
class CryptoUtils:
    key: bytes

    def pkcs7_unpadding(self, encrypt: bytes) -> bytes:
        length = len(encrypt)
        unpadding = encrypt[-1]
        return encrypt[:-unpadding]

    def decrypt_aes128_ecb(self, data: bytes) -> bytes:
        cipher = AES.new(self.key, AES.MODE_ECB)
        decrypted = cipher.decrypt(data)
        return decrypted
